<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            list-style: none;
        }
        span{margin-left: 25px;}
    </style>
</head>
<body>
    <div id="app">
        品牌<input type="text" v-model="userInfo.brand">
        车型<input type="text" v-model="userInfo.series">
        生产日期<input type="text" v-model="userInfo.creation">
        <ul>
            <li v-for="(item,index) in arr" v-show ="item.bool">
               <p> 
                
                <span></span>汽车品牌:{{item.brand}} </span>
                <span> 车型：{{item.series}} </span>
                <span> 生产日期:{{item.creation}} </span>
            </p>
               
            </li>
        </ul>

    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        new Vue({
            el:"#app",
            data:{

                arr:[
                {
                brand: "奥迪",
                series: "奥迪A4",
                creation: "2021",
                bool:true
                },
                {
                    brand: "奥迪",
                    series: "奥迪A6",
                    creation: "2021",
                    bool:true
                },
                {
                    brand: "奥迪",
                    series: "奥迪A6",
                    creation: "2020",
                    bool:true
                },
                {
                    brand: "奥迪",
                    series: "奥迪A8",
                    creation: "2020",
                    bool:true
                },
                {
                    brand: "宝马",
                    series: "宝马7",
                    creation: "2020",
                    bool:true
                },
                {
                    brand: "宝马",
                    series: "宝马X5",
                    creation: "2021",
                    bool:true
                },
                {
                    brand: "宝马",
                    series: "宝马1",
                    creation: "2019",
                    bool:true
                },
                {
                    brand: "宝马",
                    series: "宝马4",
                    creation: "2019",
                    bool:true
                },
                ],
                userInfo:{
                    brand:'',
                    series:'',
                    creation:'',
                }
            },
            
            watch:{

                userInfo:{
                    deep:true,
                    handler(newValue,oldValue){
                        console.log(newValue); 
                        this.arr.forEach(function(item,index){
                            //判断车型
                            if(newValue.brand === item.brand || newValue.brand === ''){
                                item.bool = true;
                                //判断型号
                                if(newValue.series === item.series || newValue.series === ''){
                                item.bool = true;
                                    //判断生成日期
                                    if(newValue.creation === item.creation || newValue.creation === ''){
                                        item.bool = true;
                                            }else{
                                                item.bool = false;
                                            }
                                    }else{
                                        item.bool = false;
                                        }
                                    
                            }else{
                                item.bool = false;
                            }
                        })
                        
                        
                    }
                }
            },
            methods:{
                
                
            },

        })

    </script>
</body>
</html>